package org.nepu.scr.indexrate.converter.riskrate.equipmentdata.drillingdevice;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentdata.drillingdevice.EmergencyPersonnelList;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class EmergencyPersonnelListConverter implements AttributeConverter<EmergencyPersonnelList, String> {
    @Override
    public String convertToDatabaseColumn(EmergencyPersonnelList emergencyPersonnelList) {
        return JSONUtil.toJsonStr(emergencyPersonnelList);
    }

    @Override
    public EmergencyPersonnelList convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, EmergencyPersonnelList.class);
    }
}
